﻿Public MustInherit Class VbView(Of TModel As Class)
    Inherits VbView

    Private _viewData As ViewDataDictionary(Of TModel)

    Public Shadows ReadOnly Property Model() As TModel
        Get
            Return ViewData.Model
        End Get
    End Property

    Public Shadows Property ViewData() As ViewDataDictionary(Of TModel)
        Get
            If _viewData Is Nothing Then
                SetViewData(New ViewDataDictionary(Of TModel)())
            End If
            Return _viewData
        End Get
        Set(ByVal value As ViewDataDictionary(Of TModel))
            SetViewData(value)
        End Set
    End Property

    Protected Overloads Overrides Sub SetViewData(ByVal viewData As ViewDataDictionary)
        _viewData = New ViewDataDictionary(Of TModel)(viewData)

        MyBase.SetViewData(_viewData)
    End Sub

End Class
